package no.sachmuld.methodcombination.examples.reflection.clossimplestyle.foo;

import no.sachmuld.methodcombination.api.BehaviourChain;
import no.sachmuld.methodcombination.api.reflection.*;

import java.util.List;

/**
 *
 */
public abstract class Foo {

    private BehaviourChain<FooBehaviour> chain = new BehaviourChain<>();

    public final List<String> list() {
        return new no.sachmuld.methodcombination.api.reflection.List<String>().build(FooBehaviour.class, Foo.class, "list").execute(this, chain);
    }

    public final List<String> append() {
        return new Append<String>().build(FooBehaviour.class, Foo.class, "append").execute(this, chain);
    }

    public final boolean or() {
        return new Or().build(FooBehaviour.class, Foo.class, "or").execute(this, chain);
    }

    public final boolean and() {
        return new And().build(FooBehaviour.class, Foo.class, "and").execute(this, chain);
    }

    public final void all() {
        new All().build(FooBehaviour.class, Foo.class, "all").execute(this, chain);
    }

    public final int sum() {
        return new Sum<Integer>().build(FooBehaviour.class, Foo.class, "sum").execute(this, chain);
    }

    public final int min() {
        return new Min<Integer>().build(FooBehaviour.class, Foo.class, "min").execute(this, chain);
    }

    public final int max() {
        return new Max<Integer>().build(FooBehaviour.class, Foo.class, "max").execute(this, chain);
    }

    final protected Foo with(FooBehaviour... behaviours) {
        chain.addAll(behaviours);
        return this;
    }


}
